package a_java_48_day.day5;
/**
 * 回文求和
 */

import java.util.*;
import java.lang.*;
public class Main1 {
    public static boolean isPalindrome(List list) {
        int len = list.size()-1;
        for (int i = 0; i < len / 2; i++) {
            if (list.get(i) != list.get(len - 1 - i)) {
                return false;
            }
        }
        return true;
    }
    public static void addStr(List <Character> list, String str) {
        for (int i = 0; i < str.length(); i++) {
            list.add(str.charAt(i));
        }
        list.add(' ');
    }
    public static void addStr(List <Character> list, String str, int i) {
        for (int j = str.length() - 1; j >= 0; j--) {
            list.add(i, str.charAt(j));
        }
    }
    public static void removeStr(List <Character> list, String str, int i) {
        for (int j = 0; j < str.length();j++) {
            list.remove(i);
        }
    }
    public static void main(String[] args) {
        List<Character>list = new ArrayList<>();
        Scanner in = new Scanner(System.in);
        String strA = in.nextLine();
        String strB = in.nextLine();
        int count = 0;
        addStr(list, strA);
        for (int i = 0; i < list.size(); i++) {
            addStr(list, strB, i);
            if (isPalindrome(list)) {
                count++;
            }
            removeStr(list, strB, i);
        }
        System.out.println(count);
    }
}